package pokemon;



public class IndividualPokemon extends Pokemon 
{
	public IndividualPokemon(int id, int form, String name, Types type1,
			Types type2, String ability, int hp, int attack, int defense,
			int specAtk, int specDef, int speed) 
	{
		super(id, form, name, type1, type2, ability, hp, attack, defense, specAtk,
				specDef, speed);
		
		Ability theAbil = Pokedex.abil.getAbility(getAbility1());
		if(theAbil!=null)
		{
			for(int i = 0; i < theAbil.getTypes().size(); i++)
			{
				Types theName = Types.getType(theAbil.getTypes().get(i));
				Double theMod = theAbil.getModifiers().get(i);
				Double theResult = -1.0;
				for(Types t:neutral)
				{
					if(theName.equals(t))
					{
						theResult=1*theMod;
					}
				}
				for(Types t:weaknessesX2)
				{
					if(theName.equals(t))
					{
						theResult=2*theMod;
					}
				}
				for(Types t:weaknessesX4)
				{
					if(theName.equals(t))
					{
						theResult=4*theMod;
					}
				}
				for(Types t:resistancesX2)
				{
					if(theName.equals(t))
					{
						theResult=.5*theMod;
					}
				}
				for(Types t:resistancesX4)
				{
					if(theName.equals(t))
					{
						theResult=.25*theMod;
					}
				}
				if(neutral.contains(theName))
				{
					neutral.remove(theName);
				}
				if(weaknessesX2.contains(theName))
				{
					weaknessesX2.remove(theName);
				}
				else if(weaknessesX4.contains(theName))
				{
					weaknessesX4.remove(theName);
				}
				else if(resistancesX2.contains(theName))
				{
					resistancesX2.remove(theName);
				}
				else if(resistancesX4.contains(theName))
				{
					resistancesX4.remove(theName);
				}
				
				if(theResult == 2)
				{
					weaknessesX2.add(theName);
				}
				else if(theResult == 4)
				{
					weaknessesX4.add(theName);
				}
				else if(theResult == .5)
				{
					resistancesX2.add(theName);
				}
				else if(theResult == .25)
				{
					resistancesX4.add(theName);
				}
				else if(theResult == 0)
				{
					immunities.add(theName);
				}
				//Dry skin.
			}
		}
	}
	

}
